Groups the elements of a collection according to a specified key selector function and creates a result value from each group and its key.

Namespace:  C1.LiveLinq
Assembly:  C1.LiveLinq (in C1.LiveLinq.dll)

Syntax

C#
public static IIndexedSource<TResult> GroupBy<TSource, TKey, TResult>(
	this IIndexedSource<TSource> source,
	Expression<Func<TSource, TKey>> keySelector,
	Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector
)
Visual Basic
<ExtensionAttribute> _
Public Shared Function GroupBy(Of TSource, TKey, TResult) ( _
	source As IIndexedSource(Of TSource), _
	keySelector As Expression(Of Func(Of TSource, TKey)), _
	resultSelector As Expression(Of Func(Of TKey, IEnumerable(Of TSource), TResult)) _
) As IIndexedSource(Of TResult)

Parameters

source
Type: C1.LiveLinq.Indexing..::..IIndexedSource<(Of <(<'TSource>)>)>
An IIndexedSource<(Of <(<'T>)>)> whose elements to group
keySelector
Type: System.Linq.Expressions..::..Expression<(Of <(<'Func<(Of <(<'TSource, TKey>)>)>>)>)>
A function to extract the key for each element.
resultSelector
Type: System.Linq.Expressions..::..Expression<(Of <(<'Func<(Of <(<'TKey, IEnumerable<(Of <(<'TSource>)>)>, TResult>)>)>>)>)>
A function to create a result value from each group.

Type Parameters

TSource
The type of the elements of source.
TKey
The type of the key returned by keySelector.
TResult
The type of the result value returned by resultSelector

Return Value

A collection of elements of type TResult where each element represents a projection over a group and its key.

See Also